home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / et / et3_0-a1.lha / et3 / src / EditDialog.C < prev    next >
C/C++ Source or Header  |  1992-06-15  |  2KB  |  92 lines

  1. #ifdef __GNUG__
  2. #pragma implementation
  3. #endif
  4.  
  5. #include "EditDialog.h"
  6.  
  7. #include "Class.h"
  8. #include "Dialog.h"
  9. #include "Scroller.h"
  10. #include "VObjectText.h"
  11. #include "VObjectTView.h"
  12. #include "MenuBar.h"
  13. #include "CommandProcessor.h"
  14. #include "Window.h"
  15. #include "Expander.h"
  16.  
  17. //---- EditDialog --------------------------------------------------------------
  18.  
  19. NewMetaImpl(EditDialog,Manager, (TP(textView), TP(tvClipper)));
  20.  
  21. EditDialog::EditDialog(char *t) : Manager(t)
  22. }
  23.         
  24. EditDialog::~EditDialog()
  25.     SafeDelete(textView);
  26. }
  27.  
  28. CommandProcessor *EditDialog::MakeCmdProcessor()
  29. {
  30.     return new CommandProcessor1;
  31. }
  32.  
  33. VObject *EditDialog::DoMakeContent()
  34. {
  35.     Scroller *scroller= new Scroller(textView, Point(300, 200), cIdNone, eScrollRight);
  36.     tvClipper= scroller->GetClipper();
  37.     tvClipper->SetFlag(eVObjLayoutCntl);
  38.     return scroller;
  39. }
  40.  
  41. /*
  42. Window *EditDialog::DoMakeWindows()
  43. {
  44.     VObject *inner= DoMakeContent();
  45.     menubar= DoMakeMenuBar();
  46.     if (menubar)
  47.     inner= new Expander(cIdNone, eVert, gPoint2, menubar, inner, 0);
  48.     return new Window(this, GetInitialWindowSize(), eWinBlock, inner, GetName());
  49. }
  50. */
  51.  
  52. MenuBar *EditDialog::DoMakeMenuBar()
  53. {
  54.     MenuBar *mb= Manager::DoMakeMenuBar();
  55.     mb->AddMenu(TextView::MakeMenu(cFONTMENU));
  56.     mb->AddMenu(TextView::MakeMenu(cSTYLEMENU));
  57.     mb->AddMenu(TextView::MakeMenu(cSIZEMENU));
  58.     mb->AddMenu(TextView::MakeMenu(cFORMATMENU));
  59.     return mb;
  60. }
  61.  
  62. Point EditDialog::GetInitialWindowSize()
  63. {
  64.     return Point(300, 200);
  65. }
  66.  
  67. void EditDialog::Control(int id, int detail, void *data)
  68. {
  69.     if (detail == cPartExtentChanged && data == (void*) tvClipper) {
  70.     int w= tvClipper->Width();
  71.     if (textView->Width() != w)
  72.         textView->SetWidth(w);
  73.     } else
  74.     Manager::Control(id, detail, data);
  75. }
  76.  
  77. void EditDialog::ShowEditDialog(Text *text)
  78. {
  79.     textView= new VObjectTextView(this, Rectangle(300,cFit), (VObjectText*) text);
  80.     OpenAt(0, GetInitialWindowPos(), TRUE, TRUE);
  81. }
  82.  
  83. void EditDialog::ShowEditor(char *title, Text *t)
  84. {
  85.     EditDialog *ed= new EditDialog(title);
  86.     ed->ShowEditDialog(t);
  87.     gSystem->AddCleanupObject(ed);
  88. }
  89.  
  90.